﻿using RuoVea.ExSugar.Attributes;
using System.ComponentModel.DataAnnotations;

namespace RuoVea.OmiApi.SystemApp.Entitys;

/// <summary>
/// 用户机构职位表
/// </summary>
[SugarTable(nameof(SysUserExtOrg), "用户机构职位表")]
[Description("用户机构职位表")]
[Tenant("0")]
public class SysUserExtOrg
{
    #region UserId
    /// <summary>
    /// 用户Id
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(UserId), columnDescription:"用户Id")]
    public long UserId { get; set; }

    /// <summary>
    /// 用户
    /// </summary>
    [Newtonsoft.Json.JsonIgnore]
    [System.Text.Json.Serialization.JsonIgnore]
    [Navigate(NavigateType.OneToOne, nameof(UserId))]
    public SysUser SysUser { get; set; }
    #endregion

    #region OrgId
    /// <summary>
    /// 机构Id
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(OrgId), columnDescription:"机构Id")]
    public long OrgId { get; set; }

    /// <summary>
    /// 机构
    /// </summary>
    [Newtonsoft.Json.JsonIgnore]
    [System.Text.Json.Serialization.JsonIgnore]
    [Navigate(NavigateType.OneToOne, nameof(OrgId))]
    public SysOrganization SysOrganization { get; set; }
    #endregion

    #region PosId
    /// <summary>
    /// 职位Id
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(PosId), columnDescription:"职位Id")]
    public long PosId { get; set; }

    /// <summary>
    /// 职位
    /// </summary>
    [Newtonsoft.Json.JsonIgnore]
    [System.Text.Json.Serialization.JsonIgnore]
    [Navigate(NavigateType.OneToOne, nameof(PosId))]
    public SysPosition SysPosition { get; set; }
    #endregion

    /// <summary>
    /// 默认机构职位
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(IsDefault), columnDescription:"默认机构职位", IsNullable = true)]
    public YesOrNot? IsDefault { get; set; } = YesOrNot.N;

    /// <summary>
    /// 工号
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(JobNum), columnDescription:"工号", Length = 32, IsNullable = true)]
    [MaxLength(32)]
    public string JobNum { get; set; }

    /// <summary>
    /// 职级
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(PosLevel), columnDescription:"职级", Length = 32, IsNullable = true)]
    [MaxLength(32)]
    public string PosLevel { get; set; }

    /// <summary>
    /// 入职日期
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(JoinDate), columnDescription:"入职日期", IsNullable = true)]
    public DateTime? JoinDate { get; set; }
}

